<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1{
            width: 100px;
            height: 100px;
            background-color: hwb(119 0% 0%);
        }
    </style>
</head>
<body>
    <div class="box1" draggable="true">   </div>

    <script>
        var box = document.querySelector('.box1');
        box.ondragstart = function(){
            console.log("拖拽开始");
        }
        box.ondragend = function(){
         console.log("拖拽结束");

        }

         box.ondragleave  = function(){
         console.log("拖拽离开");

        }

         box.ondrag = function () {
            console.log('拖拽');
        }
    </script>
</body>
</html>